package com.itheima.springbootwebtlias.mapper;

import com.itheima.springbootwebtlias.pojo.Clazz;
import com.itheima.springbootwebtlias.pojo.ClazzQueryParam;
import com.itheima.springbootwebtlias.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface ClazzMapper {

    //添加班级
    @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject,create_time,update_time) " +
            "value(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime});")
    void saveClazz(Clazz clazz);

    //查询班级
    @Select("select * from clazz")
    List<Clazz> selectAll();

    //班级列表查询
    List <Clazz> selectByCondition(ClazzQueryParam queryParam);

    //删除班级
    @Delete("delete from clazz where id=#{id}")
    void removeById(Integer id);

    //根据id查询班级
    @Select("select * from clazz where id=#{id}")
    Clazz findById(int id);

    //修改班级
    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate},master_id=#{masterId},subject=#{subject},create_time=#{createTime},update_time=#{updateTime} where id=#{id}")
    void update(Clazz clazz);



}
